<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>注册 - 图书管理系统</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css">
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com"></script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/bootstrapValidator.min.js"></script>

    <!-- 配置Tailwind颜色 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#9D8DF1', // 主色调：淡紫色
                        secondary: '#B79CED', // 次要色：淡紫色渐变
                        tertiary: '#D6C6FF', // 第三色：更淡的紫色
                        light: '#F5F3FF', // 浅色背景
                        dark: '#3F3F46', // 深色文本
                        success: '#86EFAC', // 成功状态
                        warning: '#FDE68A', // 警告状态
                        danger: '#FCA5A5', // 危险状态
                    },
                    fontFamily: {
                        inter: ['Inter', 'sans-serif'],
                    },
                }
            }
        }
    </script>

    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .hover-scale {
                @apply transition-transform duration-200 hover:scale-102;
            }
            .hover-lift {
                @apply transition-all duration-300 hover:-translate-y-1 hover:shadow-lg;
            }
            .card-shadow {
                @apply shadow-[0_10px_30px_-5px_rgba(157,141,241,0.15)];
            }
            .btn-shadow {
                @apply shadow-[0_4px_15px_-5px_rgba(157,141,241,0.3)];
            }
            .input-focus {
                @apply focus:border-primary focus:ring-2 focus:ring-primary/20;
            }
            .bg-gradient-purple {
                @apply bg-gradient-to-br from-primary/5 to-secondary/5;
            }
            .text-gradient {
                @apply bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary;
            }
            .form-square {
                @apply rounded-none border border-gray-200;
            }
            .form-square:focus {
                @apply border-primary ring-2 ring-primary/20;
            }
        }
    </style>

    <style>
        body {
            background-color: #F9FAFF;
            background-image:
                    radial-gradient(circle at 10% 20%, rgba(157, 141, 241, 0.05) 0%, transparent 20%),
                    radial-gradient(circle at 90% 80%, rgba(183, 156, 237, 0.05) 0%, transparent 20%);
            font-family: 'Inter', sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
            padding: 15px;
        }

        .div-signin {
            max-width: 320px;
            width: 100%;
        }

        .panel {
            border: none;
            border-radius: 0;
            box-shadow: 0 8px 20px -5px rgba(157, 141, 241, 0.15);
            overflow: hidden;
            transition: all 0.3s ease;
            background-color: white;
            border: 1px solid #E5E7EB;
        }

        .panel:hover {
            box-shadow: 0 12px 30px -5px rgba(157, 141, 241, 0.2);
            border-color: #D1D5DB;
        }

        .panel-heading {
            background: linear-gradient(135deg, #9D8DF1 0%, #B79CED 100%);
            color: white;
            border: none;
            padding: 20px 24px;
            text-align: left;
            position: relative;
            border-bottom: 1px solid rgba(255,255,255,0.2);
        }

        .panel-heading h3 {
            margin: 0;
            font-weight: 600;
            font-size: 18px;
            letter-spacing: 0.5px;
        }

        .panel-body {
            padding: 24px;
        }

        .form-horizontal .form-group {
            margin-left: 0;
            margin-right: 0;
            margin-bottom: 16px;
            position: relative;
        }

        .form-group label {
            font-weight: 500;
            color: #3F3F46;
            padding-left: 0;
            margin-bottom: 8px;
            display: block;
            font-size: 12px;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }

        .form-control {
            border-radius: 0;
            border: 1px solid #E5E7EB;
            padding: 12px 16px;
            height: auto;
            transition: all 0.2s ease;
            font-size: 14px;
            background-color: #F9FAFF;
            width: 100%;
        }

        .input-icon {
            position: absolute;
            top: 15px;
            left: 16px;
            color: #9D8DF1;
            font-size: 14px;
            z-index: 10;
        }

        .form-control-with-icon {
            padding-left: 36px;
        }

        .btn-primary {
            background: linear-gradient(135deg, #9D8DF1 0%, #B79CED 100%);
            border: none;
            border-radius: 0;
            padding: 12px;
            font-weight: 500;
            font-size: 14px;
            transition: all 0.2s ease;
            box-shadow: 0 4px 10px -3px rgba(157, 141, 241, 0.3);
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, #B79CED 0%, #9D8DF1 100%);
            transform: translateY(-1px);
            box-shadow: 0 5px 12px -3px rgba(157, 141, 241, 0.4);
        }

        .btn-primary:active {
            transform: translateY(0);
            box-shadow: 0 2px 8px -3px rgba(157, 141, 241, 0.4);
        }

        /* 表单验证样式 */
        .has-error .help-block {
            color: #FCA5A5;
            margin-top: 4px;
            font-size: 11px;
            padding-left: 16px;
            position: relative;
        }

        .has-error .help-block::before {
            content: "\f06a";
            font-family: "FontAwesome";
            position: absolute;
            left: 0;
            top: 0;
        }

        .has-error .form-control {
            border-color: #FCA5A5;
            box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.1);
        }

        .has-success .form-control {
            border-color: #86EFAC;
            box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.1);
        }

        /* 底部链接 */
        .bottom-link {
            text-align: center;
            margin-top: 16px;
            font-size: 12px;
        }

        .bottom-link a {
            color: #9D8DF1;
            font-weight: 500;
            text-decoration: none;
            transition: all 0.2s ease;
        }

        .bottom-link a:hover {
            color: #7B61FF;
            text-decoration: underline;
        }

        /* 响应式调整 */
        @media (max-width: 576px) {
            .panel-heading {
                padding: 18px 20px;
            }

            .panel-body {
                padding: 20px;
            }

            .form-control {
                padding: 10px 14px;
            }

            .input-icon {
                left: 14px;
                top: 30px;
                font-size: 12px;
            }

            .form-control-with-icon {
                padding-left: 32px;
            }

            .btn-primary {
                padding: 10px;
                font-size: 13px;
            }
        }

        /* 装饰元素 */
        .decoration-square {
            position: absolute;
            width: 60px;
            height: 60px;
            border: 1px solid rgba(157, 141, 241, 0.1);
            z-index: -1;
        }

        .square-1 {
            top: -30px;
            left: -30px;
        }

        .square-2 {
            bottom: -30px;
            right: -30px;
            border-color: rgba(183, 156, 237, 0.1);
        }
    </style>
</head>
<body class="relative">
<div class="decoration-square square-1"></div>
<div class="decoration-square square-2"></div>

<div class="container div-signin">
    <div class="panel panel-primary div-shadow">
        <div class="panel-heading">
            <h3>用户注册</h3>
        </div>
        <div class="panel-body">
            <form action="/register" method="post" id="frmRegister" class="form-horizontal">
                <!-- 新增用户名表单字段 -->
                <div class="form-group">
                    <label class="control-label">用户名</label>
                    <div class="relative">
                        <span class="input-icon">
                            <i class="fa fa-user"></i>
                        </span>
                        <input type="text" name="username" class="form-control form-control-with-icon input-focus form-square" placeholder="请设置用户名">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">手机号码</label>
                    <div class="relative">
                        <span class="input-icon">
                            <i class="fa fa-phone"></i>
                        </span>
                        <input type="text" name="phone" class="form-control form-control-with-icon input-focus form-square" placeholder="请输入11位手机号码">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">设置密码</label>
                    <div class="relative">
                        <span class="input-icon">
                            <i class="fa fa-lock"></i>
                        </span>
                        <input type="password" name="password" class="form-control form-control-with-icon input-focus form-square" placeholder="请设置6-20位密码">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">确认密码</label>
                    <div class="relative">
                        <span class="input-icon">
                            <i class="fa fa-lock"></i>
                        </span>
                        <input type="password" name="confirmPassword" class="form-control form-control-with-icon input-focus form-square" placeholder="请再次输入密码">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <button type="submit" class="btn btn-primary btn-block hover-lift">
                            <i class="fa fa-check mr-2"></i>立即注册
                        </button>
                    </div>
                </div>
                <div class="bottom-link">
                    <p>已有账号？ <a href="/login">点击登录</a></p>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('#frmRegister').bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                // 新增用户名验证规则
                username: {
                    validators: {
                        notEmpty: { message: '用户名不能为空' },
                        stringLength: { min: 3, max: 20, message: '用户名长度必须在3到20位之间' },
                        regexp: {
                            regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                            message: '用户名只能包含字母、数字和中文'
                        }
                    }
                },
                phone: {
                    validators: {
                        notEmpty: { message: '手机号不能为空' },
                        regexp: {
                            regexp: /^1[3-9]\d{9}$/,
                            message: '请输入有效的手机号码'
                        }
                    }
                },
                password: {
                    validators: {
                        notEmpty: { message: '密码不能为空' },
                        stringLength: { min: 6, max: 20, message: '密码长度必须在6到20位之间' }
                    }
                },
                confirmPassword: {
                    validators: {
                        notEmpty: { message: '请确认密码' },
                        identical: { field: 'password', message: '两次输入的密码不一致' }
                    }
                }
            }
        });
    });
</script>
</body>
</html>